// 轮播图
var mySwiper = new Swiper('.swiper', { // 垂直切换选项
    loop: true, // 循环模式选项

    // 如果需要分页器
    pagination: {
        el: '.swiper-pagination',
    },

    // 如果需要前进后退按钮
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    autoplay: {
        delay: 3000,
    },
})  



let index = 0
let box=document.querySelectorAll(".box1")
// console.log(box);
setInterval(function () {
    box.forEach(function(v,i){
       v.style.opacity="0"
    })
    index++
    if(index==box.length){
        index=0
    }
    box[index].style.opacity=1
}, 1000)





let pz = document.querySelector(".go-top")
// console.log(pz);
window.addEventListener("scroll", function () {
    window.scrollY >= 500 ? pz.style.display = "block" : pz.style.display = "none"
})
pz.onclick = function () {
    scrollTo(0, 0)
}





let lis = document.querySelectorAll(".main .scrend ul li");
console.log(lis);
for (let i = 0; i < lis.length; i++) {
    // 鼠标移入
    lis[i].addEventListener("mouseenter", function () {
        lis[i].style.backgroundColor = "blue"
        lis[i].style.color = "#fff"
        lis[i].children[0].src = lis[i].children[0].src.replace(".svg", "-c.svg")
    })
    //鼠标移出
    lis[i].addEventListener("mouseleave", function () {
        lis[i].style.backgroundColor = "#fff"
        lis[i].style.color = "black"
        lis[i].children[0].src = lis[i].children[0].src.replace("-c.svg", ".svg")
    })
}